package com.hllxd.hism.passport.login.gateway.controller;


import com.hllxd.hism.passport.login.gateway.util.ResultUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by geran on 16/12/28.
 */
@RestController
@RequestMapping("/environment")
public class EnvironmentController {

    private final static Logger LOGGER = LoggerFactory.getLogger(EnvironmentController.class);

    @Autowired
    Environment environment;

    @RequestMapping("/getCurrentEnvironment")
    public Object getMerchantTotalAmountReport() throws Exception {
        String profile = "";
        if ("production".equals(environment.getActiveProfiles()[0])) {
            profile = "production";
        } else {
            profile = "test";
        }
        Map<String, Object> dataMap = new HashMap<String, Object>(5);
        dataMap.put("environment", profile);
        return ResultUtils.result(dataMap);
        //generateSuccessResult(dataMap);

    }

}
